﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Reflection;
using System.Drawing.Text;

namespace BACKOFFICE
{
    public partial class PosScreenSaverSetup : DevExpress.XtraEditors.XtraUserControl
    {
        string txtFont = "Arial";
        FontStyle txtFontStyle = FontStyle.Regular;
        int txtFontSize = 20;

        public PosScreenSaverSetup()
        {
            InitializeComponent();

            splitContainerControl1.Panel2.BackColor = Color.Black;


            Type colorType = typeof(System.Drawing.Color);
            // We take only static property to avoid properties like Name, IsSystemColor ...
            PropertyInfo[] propInfos = colorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public);
            foreach (PropertyInfo propInfo in propInfos)
            {
                Console.WriteLine(propInfo.Name);

                comboBoxEdit1.Properties.Items.Add(propInfo.Name);
                comboBoxEdit2.Properties.Items.Add(propInfo.Name);
            }

            for (int i = 10; i < 73; i++)
            {
                comboBoxEdit3.Properties.Items.Add(i.ToString());
            }

            FontFamily[] fontFamilies;

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();
            fontFamilies = installedFontCollection.Families;
            foreach (var Fonts in fontFamilies)
            {
                comboBoxEdit4.Properties.Items.Add(Fonts.Name);
            }

        }

        private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
        {

            Color color = Color.FromName(comboBoxEdit1.SelectedText);
            splitContainerControl1.Panel2.BackColor = color;
        }

        private void comboBoxEdit2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Color color = Color.FromName(comboBoxEdit2.SelectedText);
            splitContainerControl1.Panel2.ForeColor = color;
        }

        private void textEdit1_EditValueChanged(object sender, EventArgs e)
        {
            lblText.Text = textEdit1.Text;
        }

        private void comboBoxEdit4_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtFont = comboBoxEdit4.SelectedText;

            try
            {
                lblText.Font = new Font(txtFont.ToString(), txtFontSize, FontStyle.Regular);
            }
            catch
            {

            }
        }

        private void comboBoxEdit3_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtFontSize = Convert.ToInt32(comboBoxEdit3.SelectedText);

            //MessageBox.Show(txtFontSize.ToString());
            try
            {
                lblText.Font = new Font(txtFont.ToString(), txtFontSize, FontStyle.Regular);
            }
            catch
            {

            }
        }
    }
}
